<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author EZM
 */
class GeneralSisResBO {
    
    var $className;
    var $medicoDao;
    var $horarioDao;
    var $tipoTarjetaDao;
    var $fichaDao;
    var $reservaDao;
    var $opcionDao;
    var $accionVisaDao;

    public function __construct() {
        $this->className = 'GeneralSisResBO';
        LogUtil::info("class $this->className", "__construct");
        $this->medicoDao = DAOFactory::getMedicoDao();
        $this->horarioDao = DAOFactory::getHorarioDao();
        $this->tipoTarjetaDao = DAOFactory::getTipoTarjetaDao();
        $this->fichaDao = DAOFactory::getFichaDao();
        $this->reservaDao = DAOFactory::getReservaDao();
        $this->opcionDao = DAOFactory::getOpcionDao(); 
        $this->accionVisaDao = DAOFactory::getAccionVisaDao();
    }

    public function __destruct() {
        LogUtil::info("class $this->className", "__destruct");
    }

    public function obtenerMedicoPorId($id) {
       LogUtil::info("class $this->className", "GeneralSisResBO - obtenerMedicoPorId:".$id);  
       $medico = null;
       try{           
           $medico = $this->medicoDao->obtenerMedicoPorId($id);                   
       }catch(Exception $e){
           LogUtil::info("class $this->className", $e->getMessage());
           throw new Exception($e->getMessage(), $e->getCode());
       }
       return $medico;
    } 
    
     public function obtenerHorarioPorId($id) {
       LogUtil::info("class $this->className", "GeneralSisResBO - obtenerHorarioPorId:".$id);  
       $horario = null;
       try{   
           $horario = $this->horarioDao->obtenerHorarioPorId($id);
       }catch(Exception $e){
           LogUtil::info("class $this->className", $e->getMessage());
           throw new Exception($e->getMessage(), $e->getCode());
       }
       return $horario;
    } 
    
    public function obtenerTipoTarjetaPorId($id) {
       LogUtil::info("class $this->className", "GeneralSisResBO - obtenerTipoTarjetaPorId:".$id);  
       $tipoTarjeta = null;
       try{           
           $tipoTarjeta = $this->tipoTarjetaDao->obtenerTipoTarjetaPorId($id);
       }catch(Exception $e){
           LogUtil::info("class $this->className", $e->getMessage());
           throw new Exception($e->getMessage(), $e->getCode());
       }
       return $tipoTarjeta;
    }
    
    public function obtenerFichaPorId($id) {
       LogUtil::info("class $this->className", "GeneralSisResBO - obtenerFichaPorId:".$id); 
       $retorno = null;
       try{                     
           $retorno = $this->fichaDao->obtenerFichaPorId($id);                    
       }catch(Exception $e){
           LogUtil::info("class $this->className", $e->getMessage());
           throw new Exception($e->getMessage(), $e->getCode());
       }
       return $retorno;
    }

    public function obtenerReservaPorId($id) {
       LogUtil::info("class $this->className", "GeneralSisResBO - obtenerReservaPorId:".$id); 
       $retorno = null;
       try{                     
           $retorno = $this->reservaDao->obtenerReservaPorId($id);                  
       }catch(Exception $e){
           LogUtil::info("class $this->className", $e->getMessage());
           throw new Exception($e->getMessage(), $e->getCode());
       }
       return $retorno;
    }  
    
    public function obtenerOpcionPorId($id) {
       LogUtil::info("class $this->className", "GeneralSisResBO - obtenerOpcionPorId:".$id); 
       $retorno = null;
       try{                     
           $retorno = $this->opcionDao->obtenerOpcionPorId($id);
       }catch(Exception $e){
           LogUtil::info("class $this->className", $e->getMessage());
           throw new Exception($e->getMessage(), $e->getCode());
       }
       return $retorno;
    } 
    
    public function obtenerAccionVisaPorCodigo($codigo) {
       LogUtil::info("class $this->className", "GeneralSisResBO - obtenerAccionVisaPorCodigo:".$codigo); 
       $retorno = null;
       try{                     
           $retorno = $this->accionVisaDao->obtenerAccionVisaPorCodigo($codigo);
       }catch(Exception $e){
           LogUtil::info("class $this->className", $e->getMessage());
           throw new Exception($e->getMessage(), $e->getCode());
       }
       return $retorno;
    } 
}
?>
